package VN.EDU.IMIC.DEVELOPER.DOTHANHTUNG.EXAM1.BAI1;

public class TriAngle implements IGeometricObject {
	private double side1;
	private double side2;
	private double side3;

	public double getSide1() {
		return side1;
	}

	public void setSide1(double side1) {
		this.side1 = side1;
	}

	public double getSide2() {
		return side2;
	}

	public void setSide2(double side2) {
		this.side2 = side2;
	}

	public double getSide3() {
		return side3;
	}

	public void setSide3(double side3) {
		this.side3 = side3;
	}

	
	@Override
	public double getArea(Object obj) {
		// TODO Auto-generated method stub
		double p = (((TriAngle) obj).getSide1()
                + ((TriAngle) obj).getSide2()
                + ((TriAngle) obj).getSide3())/2;
		return Math.sqrt(p*(p-((TriAngle) obj).getSide1())
                            * (p-((TriAngle) obj).getSide2())
                            *(p-((TriAngle) obj).getSide3()));
	}

	@Override
	public double getPerimeter(Object obj) {
		// TODO Auto-generated method stub
		return ((TriAngle)obj).getSide1() + ((TriAngle)obj).getSide2() + ((TriAngle)obj).getSide3();
	}
	
}
